// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.ai.states;

import java.util.HashMap;
import zombie.ai.State;
import zombie.characters.IsoGameCharacter;
import zombie.characters.IsoZombie;
import zombie.core.skinnedmodel.advancedanimation.AnimEvent;

public final class ZombieGetUpFromCrawlState extends State {
    private static final ZombieGetUpFromCrawlState _instance = new ZombieGetUpFromCrawlState();

    public static ZombieGetUpFromCrawlState instance() {
        return _instance;
    }

    @Override
    public void enter(IsoGameCharacter owner) {
        HashMap hashMap = owner.getStateMachineParams(this);
        IsoZombie isoZombie = (IsoZombie)owner;
        hashMap.put(1, owner.getStateMachine().getPrevious());
        if (isoZombie.isCrawling()) {
            isoZombie.toggleCrawling();
            isoZombie.setOnFloor(true);
        }
    }

    @Override
    public void execute(IsoGameCharacter owner) {
    }

    @Override
    public void exit(IsoGameCharacter owner) {
        HashMap hashMap = owner.getStateMachineParams(this);
        IsoZombie isoZombie = (IsoZombie)owner;
        isoZombie.AllowRepathDelay = 0.0F;
        if (hashMap.get(1) == PathFindState.instance()) {
            if (owner.getPathFindBehavior2().getTargetChar() == null) {
                owner.setVariable("bPathfind", true);
                owner.setVariable("bMoving", false);
            } else if (isoZombie.isTargetLocationKnown()) {
                owner.pathToCharacter(owner.getPathFindBehavior2().getTargetChar());
            } else if (isoZombie.LastTargetSeenX != -1) {
                owner.pathToLocation(isoZombie.LastTargetSeenX, isoZombie.LastTargetSeenY, isoZombie.LastTargetSeenZ);
            }
        }
    }

    @Override
    public void animEvent(IsoGameCharacter owner, AnimEvent event) {
    }
}
